<?PHP
require_once("../include/XMLSports.php");
require_once("../AFL/include/functions.php");

//Connect To Database
dbConnect();
//check to see if a Weeknum value was passed, if not, set WeekNum to CurrWeek.
if (($Weeknum == NULL) || ($Weeknum == "")) {
	$Weeknum = getWeek();
}

//check to make sure $Weeknum > 1 AND $Weeknum < 21
$Weeknum = checkWeekBounds($Weeknum);

echo "State|";

$filename = "../AFL/rss/".date("Y")."/week".$Weeknum.".xml";
//Create New XMLSports Generator
$myXMLSports = new XMLSports;
//Set the Current WEEK
$myXMLSports->SetWeek($Weeknum);
//Set the League
$myXMLSports->SetLeague("AFL");
//Set Output File Name
$myXMLSports->setOutputFile($filename);
//Generate The New SportsML XML file
$myXMLSports->generate();
$timeAdjust = 5; //Number of hours From GMT + or - to be added
$timeAdjust += date("I");
$timeAdjust *= 60;	//60 minutes in an hour
$timeAdjust *= 60;	//60 seconds in an minute
echo "Last scraped at <b>".gmdate("g:i:s a \E\T", time() - $timeAdjust)."</b>...<br/>";

?>
